Repository navigation
Conversation
- Implement GPU-accelerated fast image processor for SAM - Inherit from BaseImageProcessorFast with minimal code (~130 lines) - Override resize() to handle SAM's longest_edge parameter - Override _preprocess() to add padding capability - Override preprocess() to provide SAM-specific metadata - Maintain full compatibility with SamImageProcessor - Add comprehensive test suite with 18 passing tests - Achieve 4x+ speedup over slow processor - Add save/load compatibility with SamFastImageProcessorKwargs
- Apply black formatting to meet CI requirements - Fix import statement formatting with proper line breaks - Convert single quotes to double quotes for consistency - Add missing blank lines after docstrings - Format multi-line expressions and list comprehensions - Ensure compliance with transformers code style standards
- Apply black and ruff formatting to image_processing_sam_fast.py - Apply black and ruff formatting to test_image_processing_sam.py - Fix import organization and line length issues - Ensure full compliance with transformers CI formatting requirements - Maintain functionality while meeting all style standards
- Apply ruff format to tests/models/sam/test_image_processing_sam.py - Resolve CI formatting issues with proper ruff configuration - Ensure compliance with transformers repository formatting standards - All functionality preserved after formatting changes
|
cc @yonigozlan |
|
@yonigozlan is this ok |
yonigozlan
left a comment
There was a problem hiding this comment.
Hello @leochlon , thanks for opening this PR!
There's quite a lot missing, reminder that ALL the functionalities of the slow processor should be in the fast processor.
This is quite a difficult processor to work on, and as I'm working on Sam2 at the moment, I might work on the fast image processor of Sam myself maybe we should put this PR on hold for now
|
hey @yonigozlan I tried one more time, most of the functionality and logic between slow and fast is now 1-1 but using similar logic to the base fast image processor. would be cool if this implementation addresses your comments above! |
|
@yonigozlan let me know what else here is blocking and more than happy to take a look, test suite is all passing on my end. |
|
Thanks for the PR, and sorry it didn't make it in! This branch is based on v4, and v5 is very different, so rather than rebasing we'd love to invite you to open a new PR against
Closing this one in the meantime, thanks again! |
🎯 Summary
Implements GPU-accelerated
SamImageProcessorFastfollowing the BEiT pattern, providing 4x performance improvement over the original CPU-bound processor while maintaining 100% compatibility.fixes #36999